
function ls = LogShares(x,B,X,C,xi,p)

K = size(X,2);
C(p) = x;

ls = X * B(1:K,1) + B(K+1,1) * C + B(K+2,1) * C.^2 + xi;
ls = exp(ls);
ls = ls ./ (1 + sum(ls,1));
ls = log(ls(p,:));



